package com.example.blog.controller;


import com.example.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;


@Controller
public class ArticleController {

    @Autowired
    private ArticleService articleService ;

    @RequestMapping("/index")
    public ModelAndView index(@RequestParam(value = "start", defaultValue = "0") Integer start,@RequestParam(value = "limit", defaultValue = "2") Integer limit) {
        ModelAndView mav = new ModelAndView("/client/index");
        mav.addObject("page", articleService.articleList(start,limit));
        return mav;
    }

}